﻿using System;
using UnityEngine;

public class AnimationSpeedSetter :MonoBehaviour
{
	[Serializable]
	public class AnimationSpeedGroup
	{
		public string state;
		public float fps = 30f;
	}

	public AnimationSpeedGroup[] groups;

	public Animation ani;
	// Use this for initialization
	void Start()
	{
		if (ani != null)
		{
			int count = groups != null ? groups.Length : 0;
			for (int i = 0; i < count; ++i)
			{
				AnimationState state = ani[groups[i].state];
				state.speed = groups[i].fps / state.clip.frameRate;
			}
		}
	}
}
